package Negocio;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import Model.Casos2010;

/**
 * Servlet implementation class Servlet
 */
@WebServlet("/Servlet")
public class Servlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public Servlet() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		long id = Long.parseLong(request.getParameter("id"));
		long reicidenciaOrigem = Long.parseLong(request.getParameter("reicidenciaOrigem"));
		long versao = Long.parseLong(request.getParameter("versao"));
		String dataTerminoMudanca = request.getParameter("dataTerminoMudanca").substring(8, 10) + "/" +request.getParameter("dataTerminoMudanca").substring(5, 7) + "/"+ request.getParameter("dataTerminoMudanca").substring(0, 4) ;
		String programa = request.getParameter("programa");
		String classificacao = request.getParameter("classificao");
		String tipo = request.getParameter("tipo");
		String grupoExecutor = request.getParameter("grupoExecutor");
		String executor = request.getParameter("executor");
		long tarefa = Long.parseLong(request.getParameter("tarefa"));
		String tipoTarefa = request.getParameter("tipoTarefa");
		String prioridade = request.getParameter("prioridade");
		String prioridadeTarefa = request.getParameter("prioridadeTarefa");
		String analiseCritica = request.getParameter("analiseCritica");
		String dataTermino = request.getParameter("dataTermino");
		double tempoPrevisto = Double.parseDouble(request.getParameter("tempoPrevisto"));
		double tempoExecutado = Double.parseDouble(request.getParameter("tempoExxecutado"));
		String analiseDesenv = request.getParameter("analiseDesenv");
		String analiseQual = request.getParameter("analiseQual");
		String analiseNeg = request.getParameter("analiseNeg");
		
		Casos2010 caso2010 = new Casos2010(id, reicidenciaOrigem, versao, dataTerminoMudanca, programa,
				classificacao, tipo, grupoExecutor, executor, prioridade, tarefa, tipoTarefa, 
				prioridadeTarefa, analiseCritica, dataTermino, tempoPrevisto, 
				tempoExecutado, analiseDesenv, analiseQual, analiseNeg);

		
		PrintWriter p = response.getWriter();
		p.write("<h1>" + dataTermino + "</h1>");
		p.flush();
		
	}

}
